﻿using System;
using System.Collections.Generic;
using System.Text;

namespace csharpcore7_ch3_SealedClass
{
    public class Asset
    {
        public string Name;
        //Liability债务属性
        public virtual decimal Liability => 0;  //表达体属性
    }

    public class Stock : Asset
    {
        public long SharesOwned;
    }
    public class House : Asset
    {
        public decimal Mortgage;
        
        //密封House类的Liability实现，防止继承了House的子类重写Liablity
        public sealed override decimal Liability => Mortgage;
    }
    public class HouseHi : House
    {
        public decimal carloan;
        //public override decimal Liability => 10; //基类属性Liability是密封的，不能被重写
        public new decimal Liability => Liability + carloan;//虽然密封可以防止重写，但是它却无法阻止成员被隐藏
    }
    class Chapt3_2_6SealedFunctionAndClass
    {
    }
}
